package com.hjms.tenant.controller;

import com.hjms.tenant.contracts.ITenantService;
import com.hjms.tenant.contracts.dto.tenant.AddTenantDto;
import com.hjms.tenant.contracts.vo.tenant.TenantVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 何杨谊
 * @description: TODO
 * @date 2023/1/2 13:37
 */
@Api(tags = "租户")
@RestController
@RequestMapping("api/tenant")
public class TenantController {
    @Autowired
    private ITenantService tenantService;

    /**
     * 获取租户
     *
     * @param tenantId 租户id
     * @return
     */
    @GetMapping("{tenantId}")
    @ApiOperation(value = "获取租户")
    public TenantVo Get(@PathVariable(value = "tenantId") String tenantId) {
        return tenantService.Get(tenantId);
    }

    /**
     * 新增租户
     * @param dto
     * @return 租户id
     */
    @PostMapping
    @ApiOperation(value = "新增租户")
    public String Add(@RequestBody AddTenantDto dto) {
        return tenantService.Add(dto);
    }
}
